﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage2.master" AutoEventWireup="true" CodeFile="Admin_ThemPhanLoaiCon.aspx.cs" Inherits="ChucNang_Admin_Admin_ThemDoiTacCon" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
        }
    </style>
   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" language="javascript">
    function SoLuongThuocTinhChange()
    {
        var text = document.getElementById('<%=txtSoLuongThuocTinh.ClientID%>').value;
        if(isNaN(text) == true)
        {
            alert('Phải nhập vào số lượng!');
            return false;
        }
        if(text == "")
        {
            document.getElementById("thuoctinhplaces").innerHTML="";
            return;
        }
        xmlhttp = GetXmlHttpObject();
        if (xmlhttp==null)
        {
            alert ("Your browser does not support XML HTTP Request");
            return;
        }
        var serverURL="Admin_XuLyAjaxHienThiThuocTinh.aspx";
        serverURL=serverURL+"?q="+ text;
        serverURL=serverURL+"&sid="+Math.random();
        xmlhttp.onreadystatechange=HandleResponseFromServer4;
        xmlhttp.open("GET",serverURL,true);
        xmlhttp.send(null);  
    
    
    
    }

 </script>


<center><h1>Thêm Loại Sản Phẩm </h1></center>

    <asp:DataList ID="DataList1" runat="server" DataKeyField="Id" 
        DataSourceID="ObjectDataSource1">
        <ItemTemplate>
            Thêm con cho loại sản phẩm :
            <asp:Label ID="lbPhanLoaiCha" runat="server" Font-Bold="True" 
                Text='<%# Eval("TenPhanLoai") %>'></asp:Label>
            <br />
            <br />
        </ItemTemplate>
    </asp:DataList>
    <table class="style1">
        <tr>
            <td align="right" class="style2">
                Tên phân loại:</td>
            <td>
                <asp:TextBox ID="txtTenPhanLoai" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Hình ảnh</td>
            <td>
                <asp:FileUpload ID="fileuploadHinhAnh" runat="server" />
            </td>
        </tr>
        <tr>
            <td align="right">Số lượng thuộc tính:</td>
            <td><input id="txtSoLuongThuocTinh" type="text" runat="server" onkeyup="SoLuongThuocTinhChange();"/>
            </td>
        </tr>
        
    </table>
    
    <div style="padding-left:250px;" id='thuoctinhplaces'>    
    </div>
    
    <div style="text-align:center">
            
                <asp:Button ID="btnThem" runat="server" onclick="btnThem_Click" Text="Thêm" />
&nbsp;
                <asp:Button ID="btnTroVe" runat="server" onclick="btnTroVe_Click" 
                    Text="Trở về" />
            
        </tr>
        </div>
    
    
    <br />
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        DeleteMethod="Delete" InsertMethod="Insert" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="PHANLOAI_LayTheoId" 
        TypeName="DataDSTableAdapters.PHANLOAITableAdapter" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="Original_Id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="TenPhanLoai" Type="String" />
            <asp:Parameter Name="Id_Cha" Type="Int32" />
            <asp:Parameter Name="Original_Id" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="-1" Name="Id" QueryStringField="Id_Cha" 
                Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="TenPhanLoai" Type="String" />
            <asp:Parameter Name="Id_Cha" Type="Int32" />
        </InsertParameters>
    </asp:ObjectDataSource>

   

</asp:Content>

